package sengine;

import java.util.Objects;

/**
 * Represents a collision between two sprites.
 *
 * @author twoodf5611
 */
public class Collision {

    private Object2D obj1;
    private Object2D obj2;
    private byte xdirection;
    private byte ydirection;
    
    public static byte NEGATIVE = -1;
    public static byte POSITIVE = 1;
    public static byte NONE = 0;

    public Collision(Object2D obj1, Object2D obj2) {
        this.obj1 = obj1;
        this.obj2 = obj2;
    }

    public Object2D getObj1() {
        return obj1;
    }

    public void setObj1(Object2D obj1) {
        this.obj1 = obj1;
    }

    public Object2D getObj2() {
        return obj2;
    }

    public void setObj2(Object2D obj2) {
        this.obj2 = obj2;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Collision) {
            Collision col = (Collision) obj;
            return (obj1 == col.obj1) && (obj2 == col.obj2);
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 13 * hash + Objects.hashCode(this.obj1);
        hash = 13 * hash + Objects.hashCode(this.obj2);
        return hash;
    }

    @Override
    public String toString() {
        return "Collision[obj1=" + obj1 + ", obj2=" + obj2 + ", x="+xdirection+", y="+ydirection+"]";
    }

    public byte getXdirection() {
        return xdirection;
    }

    public void setXdirection(byte xdirection) {
        this.xdirection = xdirection;
    }

    public byte getYdirection() {
        return ydirection;
    }

    public void setYdirection(byte ydirection) {
        this.ydirection = ydirection;
    }
}
